import request from '@/utils/request'

const RESOURCE_URL = 'system/users'

export function getUserList(params) {
  return request({
    url: RESOURCE_URL,
    method: 'get',
    params
  })
}

export function getRoleList() {
  return request({
    url: 'system/data',
    method: 'get',
    params: {
      model: 'role'
    }
  })
}

export function createUser(data) {
  return request({
    url: RESOURCE_URL,
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'put',
    data
  })
}

export function destroyUser(data) {
  return request({
    url: RESOURCE_URL + '/' + data.id,
    method: 'delete',
    data
  })
}
